<style>
    .layui-form-switch {
        position: relative;
        height: 22px;
        line-height: 22px;
        min-width: 35px;
        padding: 0 5px;
        margin-top: 8px;
        border: 1px solid #d2d2d2;
        border-radius: 20px;
        cursor: pointer;
        background-color: #fff;
        -webkit-transition: .1s linear;
        transition: .1s linear;
        width: 50px;

    }
    .layui-form-onswitch {
        border-color: #5FB878;
        background-color: #5FB878;
        width: 50px;
    }
    .layui-form-onswitch i {
        left: 100%;
        margin-left: -21px;
        background-color: #fff;
    }
</style>
<form action="{:url()}" method="post" class="form_single">
    <div class="box">
      <div class="box-body">
        <div class="row">
          <div class="col-md-6">
            <div class="form-group">
              <label>课程名称</label>
              <span class="">（课程名称）</span>
              <input class="form-control" name="name" onchange="this.value=this.value.substring(0, 30)" onkeydown="this.value=this.value.substring(0, 30)" onkeyup="this.value=this.value.substring(0, 30)"  placeholder="请输入课程名称" value="{$info['name']|default=''}" type="text">
            </div>
          </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>排序</label>
                    <span class="">（排序）</span>
                    <input class="form-control" name="sort" placeholder="排序越大，越靠前" value="{$info['sort']|default=''}" type="text">
                </div>
            </div>

            <div class="col-md-6">
                <div class="form-group">
                    <label>老师</label>
                    <span class="">（老师）</span>
                    <select name="teacher_id" class="form-control">
                        {volist name="teacher" id='vo'}
                        <option value="{$vo['id']}" {notempty name="info['teacher_id']"}{if condition="$info['teacher_id'] eq $vo['id']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                        {/volist}
                    </select>
                </div>
            </div>

          <div class="col-md-6">
            <div class="form-group">
                <label>课堂亮点</label>
                <span class="">（课堂亮点）</span>
                <textarea class="form-control" name="describe" rows="3" placeholder="请输入课堂亮点">{$info['describe']|default=''}</textarea>
            </div>
          </div>

            <div class="col-md-6">
                <div class="form-group">
                    <label>总集数</label>
                    <span class="">（总集数）</span>
                    <input class="form-control" name="collections" placeholder="总集数" value="{$info['collections']|default=''}" type="number">
                </div>
            </div>


            <div class="col-md-6">
                <div class="form-group">
                    <label>价格</label>
                    <span class="">（价格）</span>
                    <input class="form-control" name="money" placeholder="价格" value="{$info['money']|default=''}" type="number">
                </div>
            </div>
            <!--<div class="col-md-6">-->
                <!--<div class="form-group">-->
                    <!--<label>类型</label>-->
                    <!--<span class="">（类型）</span>-->
                    <!--<select name="type" class="form-control">-->

                        <!--<option value="1" {notempty name="info['type']"}{if condition="$info['type'] eq 1"} selected="selected" {/if}{/notempty} >视频</option>-->
                        <!--<option value="2" {notempty name="info['type']"}{if condition="$info['type'] eq 2"} selected="selected" {/if}{/notempty} >音频</option>-->
                        <!--<option value="3" {notempty name="info['type']"}{if condition="$info['type'] eq 3"} selected="selected" {/if}{/notempty} >直播</option>-->
                    <!--</select>-->
                <!--</div>-->
            <!--</div>-->
            <div class="col-md-6">
                <div class="form-group">
                    <label>内容图片</label>
                    <span class="">（请上传单张图片）</span>
                    <br/>
                    {assign name="cover_id" value="$info.cover_id|default='0'" /}
                    {:widget('file/index', ['name' => 'cover_id', 'value' => $cover_id, 'type' => 'img'])}
                </div>
            </div>


            <!--<div class="col-md-6">-->
            <!--<div class="form-group">-->
                <!--<label>多图片</label>-->
                <!--<span class="">（请上传多图片）</span>-->
                <!--<br/>-->

                <!--{assign name="img_ids" value="$info.img_ids|default=''" /}-->
                <!--{:widget('file/index', ['name' => 'img_ids', 'value' => $img_ids, 'type' => 'imgs'])}-->

            <!--</div>-->
          <!--</div>-->
            <div class="col-md-6">
                <label class="layui-form-label">是否热门</label>
                <div>
                    {if condition="isset($info) && $info['is_hot'] eq 1"}
                    <div class="layui-unselect layui-form-switch layui-form-onswitch onkey"   data-code="is_hot"   ><em>ON</em><i></i></div>
                    <div class="layui-unselect layui-form-switch offkey" style="display: none" data-code="is_hot"  ><em>OFF</em><i></i></div>
                    {else/}
                    <div class="layui-unselect layui-form-switch layui-form-onswitch onkey" data-code="is_hot"  style="display: none" ><em>ON</em><i></i></div>
                    <div class="layui-unselect layui-form-switch offkey"  data-code="is_hot"  ><em>OFF</em><i></i></div>
                    {/if}
                </div>
                <input type="hidden" name="is_hot"  value="{$info['is_hot']|default=0}"/>
            </div>
            <div class="col-md-6">
                <label class="layui-form-label">是否免费试读</label>
                <div>
                    {if condition="isset($info) && $info['type'] eq 1"}
                    <div class="layui-unselect layui-form-switch layui-form-onswitch onkey"   data-code="type"   ><em>ON</em><i></i></div>
                    <div class="layui-unselect layui-form-switch offkey" style="display: none" data-code="type"  ><em>OFF</em><i></i></div>
                    {else/}
                    <div class="layui-unselect layui-form-switch layui-form-onswitch onkey" data-code="type"  style="display: none" ><em>ON</em><i></i></div>
                    <div class="layui-unselect layui-form-switch offkey"  data-code="type"  ><em>OFF</em><i></i></div>
                    {/if}
                </div>
                <input type="hidden" name="type"  value="{$info['type']|default=0}"/>
            </div>
          </div>



      </div>

        <div class="row">




        </div>
        
      <div class="box-footer">
          
        <input type="hidden" name="id" value="{$info['id']|default='0'}"/>
        
        {include file="layout/edit_btn_group"/}
        
      </div>
        
      </div>
      </div>
</form>

<script>
    $('.onkey').click(function () {
        $(this).hide();
        $(this).next().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(0);
    })
    $('.offkey').click(function () {
        $(this).hide();
        $(this).prev().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(1);

    })

    function changevideo(v) {
        if(v==1){
            $('#video').show();
            $('#video_url').hide();
        }else{
            $('#video_url').show();
            $('#video').hide();
        }
    }
</script>